/*
 *  Copyright (c) 2022 Kirky
 *
 * Licensed under the Open Software Licence, Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/osl-3.0.php
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.lingeringdream.luciole.model.exception;

/**
 * 运行模型当中会出现的错误
 *
 * @author Kirky
 * @version 1.0
 * @date 2022/6/5
 */
public class ModelException extends RuntimeException {
    public static final int UNKNOWN = -1;
    public static final int SUCCESS = 0;
    public static final int DISCARDED = 1;
    public static final int INNER = 2;
    public static final int INACTIVE = 3;
    public static final int NOT_SUPPORTED = 4;
    public static final int ILLEGAL_PARAMETER = 5;
    public static final int OVERDUE = 6;
    public static final int NO_FOUND = 7;
    public static final int DUPLICATE_FOUND = 8;
    public static final int NO_PERMISSION = 9;
    public static final int INSUFFICIENT_RESOURCE = 10;
    public static final int ANALYSIS_FAILURE = 11;
    public static final int INTERRUPTED = 12;
    public static final int EXCEED_RANGE = 13;
    public static final int DATA_MISSING = 14;
    public static final int AUTHENTICATION_REQUIRED = 15;
    public static final int TFLITE_NOT_COMPATIBLE = 16;
    public static final int INSUFFICIENT_SPACE = 17;
    public static final int HASH_MISS = 18;
    public static final int TOKEN_INVALID = 19;

    private final int code;

    public ModelException(String message, int code) {
        super(message);
        this.code = code;
    }

    public ModelException(String message, int code, Throwable innerException) {
        super(message, innerException);
        this.code = code;
    }

    public int getErrCode() {
        return this.code;
    }

}
